Skip to content

Prevent creating duplicate files if assets and public stream is in same path.#67

Open
nmdaz wants to merge 1 commit into
acquia:8.1.xfrom
nmdaz:fix-duplicate-files
Open

Prevent creating duplicate files if assets and public stream is in same path.#67
nmdaz wants to merge 1 commit into
acquia:8.1.xfrom
nmdaz:fix-duplicate-files

Conversation

@nmdaz
Copy link
Copy Markdown

@nmdaz nmdaz commented May 12, 2026

Motivation

Site Studio’s file scanning process could create duplicate file_managed records for the same physical file. This happened when asset:// and public:// pointed to the same directory, but asset:// was processed first. In that case, Site Studio stored the file using an asset:// URI instead of matching the existing public:// record, resulting in duplicate file entities and incorrect file usage tracking.

Proposed changes

Sort the stream wrappers in FileUsage::__construct() so public is always processed first when converting file paths to stream wrapper URIs. This ensures files resolve consistently to public://, preventing duplicate file entities from being created for the same file.

No updates or migrations are required. Existing duplicate records created before this fix may still need manual cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants